#include <iostream>
#include <vector>
#include <iostream>
#include <forward_list>
#include <unordered_map>
#include <climits>
using namespace std;
// 存图的邻接表
vector<forward_list<int>> h;
unordered_map<int, bool> c;
int n, ans = INT_MAX;
void add(int a, int b)
{
    h[a].emplace_front(b);
}
int dfs(int u)
{
    c[u] = true;
    int size = 1, res = 0;
    for (auto e : h[u])
    {
        if (!c[e])
        {
            int child_size = dfs(e);
            res = max(child_size, res);
            size += child_size;
        }
    }
    int up_size = n - size;
    res = max(up_size, res);
    ans = min(ans, res);
    return size;
}
int main()
{
    cin >> n;
    h.resize(n + 1);
    for (int i = 1; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        // 无向边
        add(a, b), add(b, a);
    }
    dfs(1);
    cout << ans << endl;
    return 0;
}

// 链接：https://www.acwing.com/activity/content/code/content/8260118/
// 来源：AcWing